fix: make feature flag local tests deterministic#193
Merged
Conversation
Contributor
posthog-php Compliance ReportDate: 2026-07-01 09:36:07 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
|
Reviews (1): Last reviewed commit: "ci: suppress inherited secrets semgrep w..." | Re-trigger Greptile |
ioannisj
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Feature flag local evaluation assertions were brittle in CI because they compared raw JSON payload strings. Generated UUIDs and payload serialization details can differ by environment, making failures appear in PHP 8.2/8.3/8.4 even when behavior is correct.
Semgrep also flagged the existing
secrets: inheritusage in the feature flags project board workflow. This mirrors PostHog/posthog-js#4034: the reusable workflow currently requires inherited secrets, so the finding is suppressed inline with context.💚 How did you test it?
./vendor/bin/phpcs --standard=phpcs.xml test/FeatureFlagLocalEvaluationTest.php./vendor/bin/phpunit --bootstrap vendor/autoload.php --configuration phpunit.xml --filter FeatureFlagLocalEvaluationTest --no-coverage./vendor/bin/phpunit --bootstrap vendor/autoload.php --configuration phpunit.xml --no-coveragedocker run ... semgrep --config /rules/.semgrep/rules/ --config p/owasp-top-ten --config p/security-audit --config p/trailofbits --config p/github-actions ... --error --metrics=off .github/📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
The pi coding agent made the feature flag local evaluation test assertions deterministic by normalizing JSON payloads before comparing mocked HTTP calls, validating generated batch UUIDs without comparing their random values, and suppressing expected legacy feature-flag deprecations inside this legacy behavior test class. Deprecation-specific behavior remains covered by the dedicated deprecation tests.
After CI reported the same Semgrep
secrets: inheritfinding handled in PostHog/posthog-js#4034, the agent applied the same inlinenosemgrepsuppression to the feature flags project board workflow because the called reusable workflow requires inherited secrets today.